﻿using UnityEngine;
using System.Collections;

public class GunUseController : MonoBehaviour {

    public Transform gunPos;  // 获得枪口的位置
    public GameObject bullerPrefab;  //  获得子弹的预制体
    public float gunAttack = 200; // 将上海设置成200

	// Shot方法
    public void Shot()
    {
        GameObject go = Instantiate(bullerPrefab, gunPos.position, transform.root.rotation) as GameObject;
        GameObject go1 = Instantiate(bullerPrefab, gunPos.position, transform.root.rotation) as GameObject;
        Vector3 swa = go1.transform.eulerAngles;
        swa.y += 6;
        go1.transform.eulerAngles = swa;
        GameObject go2 = Instantiate(bullerPrefab, gunPos.position, transform.root.rotation) as GameObject;
        swa = go2.transform.eulerAngles;
        swa.y -= 6;
        go2.transform.eulerAngles = swa;


        go.GetComponent<Bullet>().attack = gunAttack;
        go1.GetComponent<Bullet>().attack = gunAttack;
        go2.GetComponent<Bullet>().attack = gunAttack;
    }

}
